# log analyzer
$LOAD_PATH << './lib'


require "010_get_http_records"
require "011_merge_http_payload"
require "012_get_facebook_http_payload"
require "014_laptop_facebook_payload"
require "015_android_facebook_payload"
require "12_get_zynga_record"
require "013_get_zynga_http_payload"
require "016_laptop_zynga_payload"
require "017_android_zynga_payload"
require "052_get_facebook_app"
require "inside_content_laptop"
require "inside_content_mobile"
require "001_get_line_number"
require "002_get_time_period"
require "like_share_comment_mobile"
require "like_share_comment_laptop"

module LogAnalyzer
  def self.help
    puts ">> running the log anaylyzer, please input command:"
  end

  def self.run_command(command)
    case command
    when "010_get_http_records"
      GetHttpRecords.run
      break
    when "011_merge_http_payload"
      MergeHttpPayloads.run
      break
    when "012_get_facebook_http_payload"
      FacebookPayload.run
      break
    when "014_laptop_facebook_payload"
      FacebookLaptop.run
       break
    when "015_android_facebook_payload"
      FacebookAndroid.run
       break
    when "12_get_zynga_record"
      ZyngaExtractor.run
       break
    when "013_get_zynga_http_payload"
      ZyngaPayload.run
       break
    when "016_laptop_zynga_payload"
      ZyngaLaptop.run
       break
    when "017_android_zynga_payload"
      ZyngaAndroid.run
       break
    when "052_get_facebook_app"
      GetFacebookApp.run
       break
    when "inside_content_laptop"
      GetFacebookURL.run
       break
    when "inside_content_mobile"
      GetMFacebookURL.run
       break
    when "001_get_line_number"
      LineStat.run
      break
    when "002_get_time_period"
      TimePeriod.run
      break
    when "like_share_comment_mobile"
      GetMFacebookLCL.run
      break
    when "like_share_comment_laptop"
      GetFacebookLCL.run
      break
    else
      puts "please select the right command."
    end
  end
end

begin
  LogAnalyzer.help
  command = gets.chomp
  puts ">> the command is: " + command 
  LogAnalyzer.run_command command
rescue Exception => e
  puts e.to_s
end



